<?php
//include Header
$path = $_SERVER['DOCUMENT_ROOT'];
include("$path/header.php");

if(isset($_SESSION['sessionid'])){
	$result = mysql_query("select beheerder from klanten where klantnummer = " . $_SESSION['klantnummer'] . ";",$server);
	$beheerder = 0;
	while($row = mysql_fetch_array($result)){
		$beheerder = $row['beheerder'];
	}
	if($beheerder == 1){
			echo "<h3>Bezoekersstatistieken</h3> <BR />";
		$result = mysql_query("SELECT DATE(`datum`) AS datum, count(`ipadres`) AS aantal
							   FROM bezoekers
							   WHERE `ipadres` <> '127.0.0.1'
							   GROUP BY DATE(`datum`)
								",$server);
								
		echo "<center><table><tr><th width='150'><H3>Datum</H3></th><th width='150'><H3>Aantal unieke bezoekers</H3></th></tr>";
		while($row = mysql_fetch_array($result)){
			echo "
			<tr align='center'>
			<td>$row[datum]</td>
			<td>$row[aantal]</td>
			</tr>
			";
			}
		echo "</table>";
	} else {
		echo "<h1>Onvoldoende rechten</h1>";
	}
} else {
	echo "<h1>Niet ingelogd</h1>";
}

//include footer
include("$path/footer.php");

?>